var list;
$.ligerDefaults.Grid.formatters['operate'] = function (num, column) {
    return '<a href="javascript:void(0)" onclick="list.editRow('+column+')">修改</a>|'
    	+'<a href="javascript:void(0)" onclick="list.deleteRow('+column+')">删除</a>'
};

$(document).ready(function(){
	$("#main").ligerLayout();
	list = new ListUI({
		add:{url:getPath()+"/permission/permissionItem/add",width:"400px",height:"320px"},
		edit:{url:getPath()+"/permission/permissionItem/edit",width:"400px",height:"320px"},
		view:{url:getPath()+"/permission/permissionItem/view",width:"400px",height:"320px"},
		gridRender:function(options){
			return $("#tableContainer").ligerGrid($.extend({},options,{
	    		columns: [ 
	            	{display: '编码', name: 'number', align: 'left', width: 80},
	            	{display: '名称', name: 'name', align: 'left', width: 70},
	            	{display: '组别', name: 'group.name', align: 'left', width: 120},
	            	{display: '状态', name: 'personPosition.position.name', align: 'left', width: 100},
	            	{display: '操作', name: 'operate', align: 'center', width: 150,type:'operate'}
	            ],
	            url:getPath()+'/permission/permissionItem/listData'
	         }));
		},
		toolBarRender:function(){
			$("#toolBar").ligerToolBar({
				items:[{id:'add',text:'新增',click:list.addRow,icon:'add'}]
			});
		}
	});
});